'use strict';

const Service=require('egg').Service;

class TypeServerice extends Service{
    async list(id){
        const {ctx,app}=this;
        const QUERY_STR='id,name,type,user_id';
        let sql=`select ${QUERY_STR} from type where user_id = 0 or user_id=${id}`;
        try {
            const result = await app.mysql.query(sql);
            // console.log(result);
            return result;
        } catch (error) {
            console.list(error);
            return null;
        }
    }
}
module.exports=TypeServerice;